'use strict';

var Router = require('koa-router');
var ctrl = require('./relation.controller');

var relationRouter = function relationRouter(app) {
  var router = new Router({
    prefix: '/v1/relations'
  });

  app
    .use(router.routes())
    .use(router.allowedMethods());

  router.get('/', ctrl.find)
    .get('/:id', ctrl.findById)
    .post('/', ctrl.create)
    .put('/:id', ctrl.updateById)
    .delete('/', ctrl.delete)
    .delete('/:id', ctrl.deleteById);

};

module.exports = relationRouter;
